<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<c:set var="grant_code"><x:out select="$xmlData/data/proposal/grant_code" /></c:set>
<c:set var="sub_grant_code"><x:out select="$xmlData/data/proposal/sub_grant_code" /></c:set>

<div class="t_bar"><span class="color_red">*</span>项目总预算（单位：万元）</div>
<table class="t_css" width="100%" border="0" cellpadding="0"
	cellspacing="1">
	<tr>
	    <td align="left"><strong>项目总预算：</strong>
	    
		</td>
		<td>
		    <input type="text" style="text-align:right;width:120px" name="budget/invest/total"
				   id="invest_total" class="gray "  disabled
				   value="<x:out select="$xmlData/data/budget/invest/total" />"/>
		</td>
		<td align="left"><strong>其中：申请专项金额：</strong>
	    
		</td>
		<td>
		    <input type="text" style="text-align:right;width:120px" name="budget/invest/zxje"
				   id="invest_zxje" class="gray "  disabled
				   value="<x:out select="$xmlData/data/budget/invest/zxje" />"/>
		</td>
		<td align="left"><strong>其它来源：</strong>
	    
		</td>
		<td>
		    <input type="text" style="text-align:right;width:120px" name="budget/invest/other"
				   id="total_other" class="gray "  disabled
				   value="<x:out select="$xmlData/data/budget/invest/other" />"/>
		</td>
	</tr>
</table>


<div class="t_bar"><span class="color_red">*</span>经费支出预算（单位：万元）</div>
<table class="t_css" width="100%" border="0" cellpadding="0"
	cellspacing="1">

	<tr class="t_tr">
		<td align="center" width="220">科目</td>
		<td class="TblHead" align="center" width="120">预算数</td>
		<td class="TblHead" align="center"width="120">其中科技拨款</td>
	</tr>
	<tr class="li_1">
		<td align="left"><strong>支出预算合计：</strong></td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[00]@invest_code"  value="00">
			<input type="hidden" name="budget/invest_detail/invest[00]/name" value="经费支出预算合计">
			<input type="text" name="budget/invest_detail/invest[00]/total_invest"disabled id="total_invest_0" 
					class="gray" disabled id="total_invest_0" style="text-align:right; width:230px;" label="经费支出预算合计"
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='00']/total_invest" />" 
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[00]/total_allot"
					  id="total_allot_0" class="gray "  label="经费支出预算中科技拨款合计" disabled
				 	 value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='00']/total_allot" />"
			/>
		</td>
		
	</tr>
	<tr class="li_2">
		<td align="left" style="padding-left:20px">1、人员费</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[01]@invest_code"  value="01">
			<input type="hidden" name="budget/invest_detail/invest[01]/name" value="人员费">
			<input type="text" name="budget/invest_detail/invest[01]/total_invest"  id="total_invest_1" 
					class="required" label="人员费预算"  onfocus="InitInput.setNumber(this,7,4,4)" style="text-align:right; width:230px;" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='01']/total_invest" />" 
					onchange="countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')" 
            />
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" id="total_allot_1"name="budget/invest_detail/invest[01]/total_allot"
					 onfocus="InitInput.setNumber(this,7,4,4)" class="required valueCompare:total_allot_1:total_invest_1" label="人员费预算中科技拨款"   
					 value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='01']/total_allot" />"
					onchange="countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')" 
			>
		</td>
	</tr>
	<tr class="li_1">
		<td align="left" style="padding-left:20px">2、设备费</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[02]@invest_code"  value="02">
			<input type="hidden" name="budget/invest_detail/invest[02]/name" value="设备费">
			<input type="text" name="budget/invest_detail/invest[02]/total_invest"  id="total_invest_2"
			 class="gray"  label="设备费预算" disabled style="text-align:right; width:230px;" 
			 value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='02']/total_invest" />" 
			 onchange="countFund('total_invest_','1,2,5,10,11','0');" 
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[02]/total_allot"
					 id="total_allot_2" class="gray "  disabled label="设备费预算中科技拨款"  
					 value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='02']/total_allot" />"
				onchange="countFund('total_allot_','1,2,5,10,11','0');" 
			>
		</td>
	</tr>
	<tr class="li_2">
		<td align="left" style="padding-left:40px">(1) 购置费：</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[03]@invest_code" value="0201" />
			<input type="hidden" name="budget/invest_detail/invest[03]/name" value="购置费" />
			<input type="text" name="budget/invest_detail/invest[03]/total_invest" id="total_invest_3" 
					style="text-align:right; width:230px;"
					class="required" label="购置费预算" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0201']/total_invest" />"  
					onfocus="InitInput.setNumber(this,7,4,4)" 
					onchange="countFund('total_invest_','3,4','2');countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"  />
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[03]/total_allot" 
					id="total_allot_3" onfocus="InitInput.setNumber(this,7,4,4)" 
					class="required valueCompare:total_allot_3:total_invest_3" label="购置费预算中科技拨款" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0201']/total_allot" />"
			onchange="countFund('total_allot_','3,4','2');countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')"  />
		</td>
	</tr>
	<tr class="li_1">
		<td align="left" style="padding-left:40px">(2) 试制费：</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[04]@invest_code" value="0202" />
			<input type="hidden" name="budget/invest_detail/invest[04]/name" value="试制费" />
			<input  type="text" name="budget/invest_detail/invest[04]/total_invest"  id="total_invest_4"  
					class="required" label="试制费预算" 
					style="text-align:right; width:230px;" value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0202']/total_invest" />"
					onfocus="InitInput.setNumber(this,7,4,4)"  
					onchange="countFund('total_invest_','3,4','2');countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"
			 />
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" id="total_allot_4"  name="budget/invest_detail/invest[04]/total_allot"  
					class="required valueCompare:total_allot_4:total_invest_4" label="试制费预算中科技拨款"
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0202']/total_allot" />"  
					onfocus="InitInput.setNumber(this,7,4,4)"    
					onchange="countFund('total_allot_','3,4','2');countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')"  
			/>
		</td>
	</tr>
	
	<tr class="li_2">
		<td align="left" style="padding-left:20px">3、相关业务费：</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[05]@invest_code"  value="03">
			<input type="hidden" name="budget/invest_detail/invest[05]/name" value="相关业务费">
			<input type="text" name="budget/invest_detail/invest[05]/total_invest" 
				 label="相关业务费预算" class="gray" disabled id="total_invest_5" 
				style="text-align:right; width:230px;" 
				value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='03']/total_invest" />" 
				onchange="countFund('total_invest_','1,2,5,10,11','0');" 
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[05]/total_allot"  id="total_allot_5" 
			onfocus="InitInput.setNumber(this,7,4,4)"  label="相关业务费预算中科技拨款" class="gray" disabled 
			value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='03']/total_allot" />"
			onchange="countFund('total_allot_','1,2,5,10,11','0');" 
			>
		</td>
	</tr>
	<tr class="li_1">
		<td align="left" style="padding-left:40px">(1) 材料费：</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[06]@invest_code" value="0301" />
			<input type="hidden" name="budget/invest_detail/invest[06]/name" value="材料费" />
			<input  type="text" name="budget/invest_detail/invest[06]/total_invest"
					class="required"  label="材料费预算"  id="total_invest_6" style="text-align:right; width:230px;" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0301']/total_invest" />" 
					onfocus="InitInput.setNumber(this,7,4,4)" 
				onchange="countFund('total_invest_','6,7,8,9','5');countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[06]/total_allot"id="total_allot_6"  
				onfocus="InitInput.setNumber(this,7,4,4)"
				class="required valueCompare:total_allot_6:total_invest_6"  label="材料费预算中科技拨款"  
				value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0301']/total_allot" />" 
				onchange="countFund('total_allot_','6,7,8,9','5');countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')" 
			/>
		</td>
	</tr>
	<tr class="li_2">
		<td align="left" style="padding-left:40px">(2) 燃料及动力费：</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[07]@invest_code" value="0302" />
			<input type="hidden" name="budget/invest_detail/invest[07]/name" value="燃料及动力费" />
			<input  type="text" name="budget/invest_detail/invest[07]/total_invest" id="total_invest_7"
					class="required" label="燃料及动力费预算"  style="text-align:right; width:230px;" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0302']/total_invest" />" onfocus="InitInput.setNumber(this,7,4,4)" 
					onchange="countFund('total_invest_','6,7,8,9','5');countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[07]/total_allot" id="total_allot_7" 
					class="required valueCompare:total_allot_7:total_invest_7" label="燃料及动力费预算中科技拨款" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0302']/total_allot" />" 
					onfocus="InitInput.setNumber(this,7,4,4)"
					onchange="countFund('total_allot_','6,7,8,9','5');countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')" 
			/>
		</td>
	</tr>
	<tr class="li_1">
		<td align="left" style="padding-left:40px">(3)	测试及化验费：</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[08]@invest_code" value="0303" />
			<input type="hidden" name="budget/invest_detail/invest[08]/name" value="测试及化验费" />
			<input  type="text" name="budget/invest_detail/invest[08]/total_invest" id="total_invest_8" 
					class="required " label="测试及化验费预算"  style="text-align:right; width:230px;" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0303']/total_invest" />" 
					onfocus="InitInput.setNumber(this,7,4,4)" 
					onchange="countFund('total_invest_','6,7,8,9','5');countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[08]/total_allot" id="total_allot_8" 
					class="required valueCompare:total_allot_8:total_invest_8" label="测试及化验费预算中科技拨款" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0303']/total_allot" />" 
					onfocus="InitInput.setNumber(this,7,4,4)"
					onchange="countFund('total_allot_','6,7,8,9','5');countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')" 
			/>
		</td>
	</tr>
	<tr class="li_2">
		<td align="left" style="padding-left:40px">(4) 	会议差旅费：</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[09]@invest_code" value="0304" />
			<input type="hidden" name="budget/invest_detail/invest[09]/name" value="会议差旅费预算" />
			<input  type="text" name="budget/invest_detail/invest[09]/total_invest" id="total_invest_9"
					class="required" label="会议差旅费预算"  style="text-align:right; width:230px;" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0304']/total_invest" />" 
					onfocus="InitInput.setNumber(this,7,4,4)" 
					onchange="countFund('total_invest_','6,7,8,9','5');countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[09]/total_allot" id="total_allot_9"  
					class="required valueCompare:total_allot_9:total_invest_9" label="会议差旅费预算中科技拨款" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='0304']/total_allot" />" 
					onfocus="InitInput.setNumber(this,7,4,4)" 
					onchange="countFund('total_allot_','6,7,8,9','5');countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')" 
			/>
		</td>
	</tr>
	<tr class="li_1">
		<td align="left" style="padding-left:20px">4、管理费</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[10]@invest_code"  value="04">
			<input type="hidden" name="budget/invest_detail/invest[10]/name" value="管理费">
			<input type="text" name="budget/invest_detail/invest[10]/total_invest"
					 class="required" label="管理费预算"  style="text-align:right; width:230px;"
					 onfocus="InitInput.setNumber(this,7,4,4)" id="total_invest_10" 
					 value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='04']/total_invest" />" 
					onchange="countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" name="budget/invest_detail/invest[10]/total_allot"
					class="required valueCompare:total_allot_10:total_invest_10" label="管理费预算中科技拨款" id="total_allot_10" 
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='04']/total_allot" />"
					onfocus="InitInput.setNumber(this,7,4,4)" 
					onchange="countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')">
		</td>
	</tr>
		<tr class="li_2">
		<td align="left" style="padding-left:20px">5、其他费用</td>
		<td>
			<input type="hidden" name="budget/invest_detail/invest[11]@invest_code"  value="05">
			<input type="hidden" name="budget/invest_detail/invest[11]/name" value="其他费用">
			<input type="text" name="budget/invest_detail/invest[11]/total_invest" id="total_invest_11" 
					class="required" label="其他费用预算"  onfocus="InitInput.setNumber(this,7,4,4)" style="text-align:right; width:230px;" value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='05']/total_invest" />" 
					onchange="countFund('total_invest_','1,2,5,10,11','0');synfun('total_invest_0','invest_total')"
			/>
		</td>
		<td>
			<input type="text" style="text-align:right;width:230px" id="total_allot_11"  name="budget/invest_detail/invest[11]/total_allot" 
					class="required valueCompare:total_allot_11:total_invest_11" label="其他费用中科技拨款"
					value="<x:out select="$xmlData/data/budget/invest_detail/invest[@invest_code='05']/total_allot" />"
					onfocus="InitInput.setNumber(this,7,4,4)"  
					onchange="countFund('total_allot_','1,2,5,10,11','0');synfun('total_allot_0','invest_zxje')"
			>
		</td>
	</tr>
</table>
<br>	

<div class="t_bar"><span class="color_red">*</span>经费来源预算（单位：万元）</div>
<table class="t_css" width="100%" border="0" cellpadding="0"
	cellspacing="1">

	<tr class="t_tr">
		<td align="center" width="220">科目</td>
		<td class="TblHead" align="center" width="120">预算数</td>
	</tr>
	<tr class="li_1">
		<td align="left"><strong>来源预算合计：</strong></td>
		<td>
			<input type="hidden" name="budget/source_detail/detail[00]@source_code"  value="00">
			<input type="hidden" name="budget/source_detail/detail[00]/name" value="研究经费">
			<input type="text" name="budget/source_detail/detail[00]/total_source"  id="total_source_0" 
					 disabled id="total_source_0" style="text-align:right; width:230px;" 
					 class="gray valueEqual:total_source_0:total_invest_0" label="经费来源预算合计"
					 value="<x:out select="$xmlData/data/budget/source_detail/detail[@source_code='00']/total_source" />" />
		</td>
	</tr>
	<tr class="li_2">
		<td align="left" style="padding-left:20px">1、科技拨款</td>
		<td>
			<input type="hidden" name="budget/source_detail/detail[01]@source_code"  value="01">
			<input type="hidden" name="budget/source_detail/detail[01]/name" value="科技拨款">
			<input type="text" name="budget/source_detail/detail[01]/total_source"  id="total_source_1" 
					onfocus="InitInput.setNumber(this,7,4,4)" class="required valueEqual:total_source_1:total_allot_0" label="经费来源预算中科技拨款"  id="total_source_1" 
					style="text-align:right; width:230px;" value="<x:out select="$xmlData/data/budget/source_detail/detail[@source_code='01']/total_source" />" 
					onchange="countFund('total_source_','1,2,3,4','0');" 

			/>
		</td>
	</tr>
	<tr class="li_1">
		<td align="left" style="padding-left:20px">2、贷    款</td>
		<td>
			<input type="hidden" name="budget/source_detail/detail[02]@source_code"  value="02">
			<input type="hidden" name="budget/source_detail/detail[02]/name" value="贷    款">
			<input type="text" name="budget/source_detail/detail[02]/total_source"  id="total_source_2" 
					 onfocus="InitInput.setNumber(this,7,4,4)" 
					 class="required" label="经费来源预算中贷 款"  id="total_source_1" style="text-align:right; width:230px;" 
					 value="<x:out select="$xmlData/data/budget/source_detail/detail[@source_code='02']/total_source" />" 
			
			onchange="countFund('total_source_','1,2,3,4','0');countNum1('total_','source_2,source_3,source_4','other')" 

			/>
		</td>
	</tr>
	<tr class="li_2">
		<td align="left" style="padding-left:20px">3、单位自筹</td>
		<td>
			<input type="hidden" name="budget/source_detail/detail[03]@source_code"  value="03">
			<input type="hidden" name="budget/source_detail/detail[03]/name" value="单位自筹">
			<input type="text" name="budget/source_detail/detail[03]/total_source"  id="total_source_3" class="required" 
						onfocus="InitInput.setNumber(this,7,4,4)" class="required" label="经费来源预算中单位自筹"
						id="total_source_3" style="text-align:right; width:230px;" 
						value="<x:out select="$xmlData/data/budget/source_detail/detail[@source_code='03']/total_source" />" 
			
						onchange="countFund('total_source_','1,2,3,4','0');countNum1('total_','source_2,source_3,source_4','other')" 

			/>
		</td>
	</tr>
	<tr class="li_1">
		<td align="left" style="padding-left:20px">4、其它来源</td>
		<td>
			<input type="hidden" name="budget/source_detail/detail[04]@source_code"  value="04">
			<input type="hidden" name="budget/source_detail/detail[04]/name" value="其它来源">
			<input type="text" name="budget/source_detail/detail[04]/total_source"  id="total_source_4" 
				 onfocus="InitInput.setNumber(this,7,4,4)" class="required" label="经费来源预算中其它来源"  
					id="total_source_4" style="text-align:right; width:230px;" 
					value="<x:out select="$xmlData/data/budget/source_detail/detail[@source_code='04']/total_source" />" 
			
			onchange="countFund('total_source_','1,2,3,4','0');countNum1('total_','source_2,source_3,source_4','other')" 
			/>
		</td>
	</tr>
	<tr class="li_2">
		<td align="left" style="padding-left:20px">5、经费来源备注（限200字）</td>
		<td>
			<textarea rows="7" cols="100" class="input_textarea required maxlength:200" class="required"  label="经费来源预算中经费来源备注"   name='budget/source_detail/summary' title="对项目经费来源情况的补充信息"><x:out select="$xmlData/data/budget/source_detail/summary"/></textarea>
		</td>
	</tr>
	</table>
	
<script type="text/javascript">
    function synfun(id1,id2){
    	$("#"+id2).val($("#"+id1).val());
    }
    
    function countNum1(idStart, countStr, totalStr) {

		var indexs = countStr.split(",");
		var count = 0;
		for ( var i = 0; i < indexs.length; i++) {
			var fund = $("#" + idStart + indexs[i]).val();
			if (!$.isNumeric(fund))
				fund = "0";
			count = ((parseFloat(count)*10000 + parseFloat(fund)*10000)/10000).toFixed(4);
		}

		count = formatNumber(count.toString(), 9, 4, 4);// 格式化金额
		$("#" + idStart + totalStr).val(count);
	}
</script>
